<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-form ref="form" :model="s_quality" :rules="rules" label-width="100px" id="mvcfm">
          <el-button @click="popQualificationSupplierAdd('')" type='success' size="mini"><i class='fa fa-plus'></i>增加资质</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 企业资质 </span>
          </div>
          <el-table :data="s_quality">
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                      <el-link @click="d_quality('&CMID1='+scope.row.quality_id+'')">删除</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="popQualificationSupplierUp('&CMID1='+scope.row.quality_id+'')">修改</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="gotoPage('/xcapi/ProcessFile/DownloadFile.do?&fileverid='+scope.row.version_id+''+vueparams+'')">下载文件</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="popSubsidiaryInformationSupplier('&fileverid='+scope.row.version_id+'')">查看文件</el-link>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="类型" prop="quality_type">
            </el-table-column>
            <el-table-column label="资质文件" prop="version_id">
              <template slot-scope="scope">
              </template>
            </el-table-column>
            <el-table-column label="证书编号" prop="quality_num">
            </el-table-column>
            <el-table-column label="资质验证" prop="verify_type">
            </el-table-column>
            <el-table-column label="资质查询网站" prop="verify_url">
              <template slot-scope="scope">
                <el-link href="gotoPage('http://'+emt.map['verify_url']+'')" type='primary'>{{scope.row.verify_url}}</el-link>
              </template>
            </el-table-column>
          </el-table>
          <el-button @click="popaccountSupplierAdd('')" type='success' size="mini"><i class='fa fa-plus'></i>增加银行账户</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 银行账户信息 </span>
          </div>
          <el-table :data="s_bank_account">
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                      <el-link @click="popaccountSupplierUp('&CMID1='+scope.row.account_id+'')">修改</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="d_bank_account('&CMID1='+scope.row.account_id+'')">删除</el-link>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="类型" prop="account_type">
            </el-table-column>
            <el-table-column label="开户银行" prop="bank_name">
            </el-table-column>
            <el-table-column label="开户名称" prop="account_name">
            </el-table-column>
            <el-table-column label="银行账户" prop="bank_account">
            </el-table-column>
          </el-table>
        </el-form>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'附属信息'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
    <el-dialog :visible.sync="QualificationSupplierAddVisible" append-to-body>
      <QualificationSupplierAdd v-if="QualificationSupplierAddVisible" ref="QualificationSupplierAdd" :popparams="popparams"> </QualificationSupplierAdd>
    </el-dialog>
    <el-dialog :visible.sync="QualificationSupplierUpVisible" append-to-body>
      <QualificationSupplierUp v-if="QualificationSupplierUpVisible" ref="QualificationSupplierUp" :popparams="popparams"> </QualificationSupplierUp>
    </el-dialog>
    <el-dialog :visible.sync="SubsidiaryInformationSupplierVisible" append-to-body>
      <SubsidiaryInformationSupplier v-if="SubsidiaryInformationSupplierVisible" ref="SubsidiaryInformationSupplier" :popparams="popparams"> </SubsidiaryInformationSupplier>
    </el-dialog>
    <el-dialog :visible.sync="accountSupplierUpVisible" append-to-body>
      <accountSupplierUp v-if="accountSupplierUpVisible" ref="accountSupplierUp" :popparams="popparams"> </accountSupplierUp>
    </el-dialog>
    <el-dialog :visible.sync="accountSupplierAddVisible" append-to-body>
      <accountSupplierAdd v-if="accountSupplierAddVisible" ref="accountSupplierAdd" :popparams="popparams"> </accountSupplierAdd>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import QualificationSupplierAdd from "@/views/psi/supplychainmana/QualificationSupplierAdd";
  import QualificationSupplierUp from "@/views/psi/supplychainmana/QualificationSupplierUp";
  import SubsidiaryInformationSupplier from "@/views/psi/supplychainmana/SubsidiaryInformationSupplier";
  import accountSupplierUp from "@/views/psi/supplychainmana/accountSupplierUp";
  import accountSupplierAdd from "@/views/psi/supplychainmana/accountSupplierAdd";
  export default {
    name: 'SubsidiaryInformationSupplier',
    components: {
      QualificationSupplierAdd,
      QualificationSupplierUp,
      SubsidiaryInformationSupplier,
      accountSupplierUp,
      accountSupplierAdd,
    },
    props: ['popparams'],
    data() {
      return {
        QualificationSupplierAddVisible: false,
        QualificationSupplierAddValue: null,
        QualificationSupplierAddDesc: null,
        QualificationSupplierUpVisible: false,
        QualificationSupplierUpValue: null,
        QualificationSupplierUpDesc: null,
        SubsidiaryInformationSupplierVisible: false,
        SubsidiaryInformationSupplierValue: null,
        SubsidiaryInformationSupplierDesc: null,
        accountSupplierUpVisible: false,
        accountSupplierUpValue: null,
        accountSupplierUpDesc: null,
        accountSupplierAddVisible: false,
        accountSupplierAddValue: null,
        accountSupplierAddDesc: null,
        vueparams: this.getVUEParams(""),
        s_quality: [],
        s_bank_account: [],
        loading: false,
        Container: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "D341BEFC81C14E98804E008EC7E6F3E5",
        name: "供应商右菜单管理",
        selected: "附属信息"
      }, 'Container', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/supplychainmana/SubsidiaryInformationSupplier/subsidiaryInformationSupplier?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_quality(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/supplychainmana/SubsidiaryInformationSupplier/d_quality?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      d_bank_account(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/supplychainmana/SubsidiaryInformationSupplier/d_bank_account?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      popQualificationSupplierAdd(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.QualificationSupplierAddVisible = !this.QualificationSupplierAddVisible;
      },
      popQualificationSupplierUp(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.QualificationSupplierUpVisible = !this.QualificationSupplierUpVisible;
      },
      popSubsidiaryInformationSupplier(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.SubsidiaryInformationSupplierVisible = !this.SubsidiaryInformationSupplierVisible;
      },
      popaccountSupplierUp(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.accountSupplierUpVisible = !this.accountSupplierUpVisible;
      },
      popaccountSupplierAdd(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.accountSupplierAddVisible = !this.accountSupplierAddVisible;
      },
    },
  }
</script>
